<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <script>
        window.onload = function () {
            var link = document.getElementById("link");
            var timerId = null;
            var num = 5;
            timerId = setInterval(function () {
                num--;
                link.innerText = "注册成功," + num + "秒后跳转到首页";
                if(num == 0){
                    clearInterval(timerId);
                    location.href = link.href;
                }
            }, 1000)
        }
    </script>
</head>
<body>
<a href="http://www.baidu.com" id="link">注册成功,5秒后跳转到首页</a>

</body>
</html>